package com.pcafs.manage.controller;

import com.pcafs.common.core.controller.BaseController;
import com.pcafs.common.core.domain.AjaxResult;
import com.pcafs.common.core.page.TableDataInfo;
import com.pcafs.manage.service.IPcafsDataCountService;
import com.pcafs.manage.vo.PcafsDatabaseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Author: hyh
 * @Date: 2022/5/11 14:35
 **/
@Api(value = "数据统计", tags = {"数据统计"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/manage/datacount")
public class PcafsDataCountController  extends BaseController {

    private final IPcafsDataCountService service;


    /**
     * 便利蜂按年统计
     */
    @ApiOperation("便利蜂按年统计")
    @GetMapping("/storeCountByYear")
    public AjaxResult storeCountByYear() {
        return AjaxResult.success(service.storeCountByYear());
    }
    @ApiOperation("便利蜂分店信息")
    @GetMapping("/getStoreInfo")
    public AjaxResult getStoreInfo() {
        return AjaxResult.success(service.getStoreInfo());
    }
    @ApiOperation("便利蜂按省统计")
    @GetMapping("/storeCountByProvince")
    public AjaxResult storeCountByProvince() {
        return AjaxResult.success(service.storeCountByProvince());
    }
    @ApiOperation("便利蜂按总数统计")
    @GetMapping("/storeCountBySum")
    public AjaxResult storeCountBySum() {
        return AjaxResult.success(service.storeCountBySum());
    }

    @ApiOperation("便利蜂收入明细按时间统计")
    @GetMapping("/storeIncomeByTime")
    public AjaxResult storeIncomeByTime(Integer type,Long id) {
        return AjaxResult.success(service.storeIncomeByTime(type,id));
    }

    @ApiOperation("便利蜂总成本按时间统计")
    @GetMapping("/storeCostByTime")
    public AjaxResult storeCostByTime(Integer type) {
        return AjaxResult.success(service.storeCostByTime(type));
    }

    @ApiOperation("便利蜂数据分析统计")
    @GetMapping("/analyzeByTime")
    public AjaxResult analyzeByTime(Integer type) {
        return AjaxResult.success(service.analyzeByTime(type));
    }

    @ApiOperation("便利蜂数据分析")
    @GetMapping("/analyzeInfo")
    public AjaxResult analyzeInfo(Integer type) {
        return AjaxResult.success(service.analyzeInfo(type));
    }

    @ApiOperation("便利蜂数据分析")
    @GetMapping("/qzxhData")
    public AjaxResult qzxhData(Integer type) {
        return AjaxResult.success(service.qzxhData(type));
    }

    @ApiOperation("协方差")
    @GetMapping("/xfcData")
    public AjaxResult xfcData(Integer type) {
        return AjaxResult.success(service.xfcData(type));
    }
    @ApiOperation("特征值矩阵")
    @GetMapping("/tzzjzData")
    public AjaxResult tzzjzData(Integer type) {
        return AjaxResult.success(service.tzzjzData(type));
    }
    @ApiOperation("特征值向量")
    @GetMapping("/tzzxlData")
    public AjaxResult tzzxlData(Integer type) {
        return AjaxResult.success(service.tzzxlData(type));
    }

    @ApiOperation("总方差解释")
    @GetMapping("/zfcjs")
    public AjaxResult zfcjs(Integer type) {
        return AjaxResult.success(service.zfcjs(type));
    }

    @ApiOperation("主成分")
    @GetMapping("/zcf")
    public AjaxResult zcf(Integer type) {
        return AjaxResult.success(service.zcf(type));
    }

    @ApiOperation("所有分店总收入支出利润")
    @GetMapping("/storeDetailCount")
    public TableDataInfo<Map> storeDetailCount(Map map) {
        startPage();
        List<Map> mapList = service.storeDetailCount();
        return getDataTable(mapList);
    }
}
